package com.kevin.enterprise.config;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "HtmlConfig")
public class HtmlConfig extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String uri=request.getRequestURI();
        System.out.println(uri);
        uri=uri.substring(31);//获取从第31个字符串开始
        System.out.println(uri);

        if("addStudentConfig".equals(uri)){
            addStudentConfig(request,response);
        }

    }

    private void addStudentConfig(HttpServletRequest request, HttpServletResponse response) {
        try {
            request.getRequestDispatcher("addStudent.jsp").forward(request,response);
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
